home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-04 | 6.0 KB | 235 lines | [TEXT/MPS ] |
- #
- # File: LocalizeDriver.vu
- #
- # Contains: Test script for Localized versions of Systems 7 and MacWrite II
- #
- # Written by: David Gaxiola
- #
- # Copyright © 1992, Apple Computer, Inc. All rights reserved
- #
- # 7/20/92 DGG Created
- # 3/4/96 JC Commented out while loop in main script.
- # To do:
- #
-
-
- Libraries "MWLocal.vu","UtilityTasks.vulib";
-
- (************************************************************************************
- * Task FindFileLocal(fileName)
- * This task will find a file using the "Find…" menu item in the File menu, using
- * name contains and on all disks at once. It assumes that the Finder is currently
- * running.
- ************************************************************************************)
- task FindFileLocal(fileName := "")
- begin
-
- global gFindName;
- global gOnDesktopString;
-
- foundFile := true;
-
- select [menuItem t:/{gFindName}≈/ m:2];
- while (not match [window t:/{gFindName}≈/])
- wait(1);
- type k:{ fileName };
- select [button t:gFindName w:1];
-
- stillSearching := true;
- # A search may not find anything or it may take a long time. This is one way
- # of dealing with the different outcomes.
- while stillSearching
- begin
- wait(2);
- thisWindow := match [window o:1];
- if (thisWindow.s = dialog)
- stillSearching := false;
- else if (thisWindow.t = gFindName)
- stillSearching := true;
- else
- stillSearching := false;
- end;
-
- if (thisWindow.s = dialog)
- begin
- if not (match [staticText t:/“{fileName}” {gOnDestopString}≈/ w:[window s:dialog o:1]])
- foundFile := false;
- select [button t:"Ok" w:[window o:1]];
- end;
-
- return foundFile;
- end;
-
- (************************************************************************************
- * Task LaunchAppInSystem7Local( appName, launchWait, closeWindow, CDEV )
- * Check for app running and/or attempt to get there by:
- * Using Finder's Find command to select the App, then using the open command.
- * ( This works only under System 7.0 )
- * launchWait is the number of seconds to wait before checking for successful
- * launch of the application.
- ************************************************************************************)
- task LaunchAppInSystem7Local( appName := "", launchWait := 6, closeWindow := true,
- CDEV := false )
- begin
-
- global gOpenName;
-
- if (not CDEV)
- match [application t:?frontApp]!;
- else
- match [window t:?frontApp o:1]!;
-
- if (not (frontApp = appName))
- begin
- if not (TwitchAppInSystem7(appName))
- begin
- TwitchAppInSystem7();
- if (FindFileLocal(appName))
- begin
- if closeWindow
- pressKey k:{optionKey};
- select [menuItem t:gOpenName m:[menu o:2]];
- if closeWindow
- releaseKey k:{optionKey};
- wait(launchWait);
-
- if (not CDEV)
- begin
- match[application t:?frontApp]!;
- if not (frontApp ~= /≈{appName}≈/)
- begin
- println "### Failed to launch ", appName;
- return false;
- end;
- end;
- else
- begin
- match [window t:?frontCDEV o:1];
- if not (frontCDEV ~= /≈{appName}≈/)
- begin
- println "### Failed to launch ", appName;
- return false;
- end;
- end;
- end;
- else
- begin
- println "### Failed to find ", appName;
- println "### Failed to launch ", appName;
- return false;
- end;
- end;
- end;
- println "### Launched ", appName;
- return true;
- end; #LaunchAppInSystem7
-
- (************************************************************************************
- * Task SetViewsControlPanel
- ************************************************************************************)
- task SetViewsControlPanel( ShowDiskInfo := true, TextFont := "Geneva", TextSize := 9 )
- begin
- global gViewsName;
- global gDiskInfoString;
-
- LaunchAppInSystem7Local(gViewsName,,,true);
-
- # Set the "Show disk info in header" check box
- if ShowDiskInfo
- begin
- if match [checkBox t:gDiskInfoString s:{ 0, 1 } ]!
- select [checkBox t:gDiskInfoString ];
- end;
- else
- begin
- if match[ checkBox t:gDiskInfoString s:{ 1, 1 } ]!
- Select [checkBox t:gDiskInfoString ];
- end;
-
- # Select medium size icons
- match [window o:1 r:?wRect];
- move a:{wRect[1] + 93, wRect[2]+187};
- click;
-
- wait(2);
-
- # Select 'Geneva' font
- select [menuItem t:TextFont m:[popup w:1]];
-
- # Select '9' font size
- select [menuItem t:/{TextSize}/ m:[popup w:1]];
-
- UseKeyboardEquivalent("w");
- end;
-
- (************************************************************************************
- * Task SetKeyboardControlPanel
- ************************************************************************************)
- task SetKeyboardControlPanel()
- begin
- global gKeyboardName;
-
- LaunchAppInSystem7Local(gKeyboardName,,,true);
-
- # Click the Off radio button
- match [window o:1 r:?wRect];
- move a:{wRect[1] + 140, wRect[2] + 50};
- click;
-
- # Close the Window
- UseKeyboardEquivalent("w");
- end;
-
- (************************************************************************************
- * Script DemoControllerMain()
- ************************************************************************************)
- script DemoControllerMain()
- begin
- localVersion := getLocalVersion();
-
- usaCDEVID := 128;
- usaFinderID := 130;
- usaViewsID := 132;
- espCDEVID := 129;
- espFinderID := 131;
- espViewsID := 133;
-
- if (localVersion = "USA")
- begin
- cdevID := usaCDEVID;
- finderID := usaFinderID;
- viewsID := usaViewsID;
- end;
- else if (localVersion = "Spanish")
- begin
- cdevID := espCDEVID;
- finderID := espFinderID;
- viewsID := espViewsID;
- end;
-
- global gCdevName := getIndString(cdevID,1);
- global gViewsName := getIndString(cdevID, 2);
- global gKeyboardName := getIndString(cdevID, 3);
- global gOpenName := getIndString(finderID, 1);
- global gFindName := getIndString(finderID, 2);
- global gOnDesktopString := getIndString(finderID, 3);
- global gDiskInfoString := getIndString(viewsID, 1);
-
- SetViewsControlPanel();
- SetKeyboardControlPanel();
-
-
- if (localVersion = "Spanish")
- macWriteName := "MacWrite II - E";
- else if (localVersion = "USA")
- macWriteName := "MacWrite II";
-
- LaunchAppInSystem7Local(macWriteName);
-
- ## To have this script run continuously uncomment the while loop block
- #while
- #begin
- MWLocalMain();
- #end;
- end;
-